<?php
Yii::import('zii.widgets.CPortlet');

class HomePortlet extends CPortlet {

	protected $role;

	private $access = false;
	public $htmlOptions = array(
		'class' => 'home-portlet'
	);

	public function init() {
		if ($this->role === null || Yii::app()->user->checkAccess($this->role)) {
			$this->access = true;
			$assetsUrl = Yii::app()->assetManager
			->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets', false, -1, YII_DEBUG);
			$cs = Yii::app()->getClientScript();
			$cs->registerCssFile($assetsUrl . '/home-portlet.css');
			parent::init();
		}
	}
	public function run() {
		if ($this->access) {
			parent::run();
		}
	}
}
